from django.urls import path
from django.views.generic import RedirectView
from rest_framework.authtoken import views
from rest_framework_jwt.views import obtain_jwt_token
# 引入视图类
from no_5.views import cookieLogin, cookieIndex, sessionLogin, sessionIndex, sessionLogout, TokenIndexView, JWTIndexView

urlpatterns = [
    path('', RedirectView.as_view(url='cookie/index.html'), name="homepage"),
    path('cookie/index.html', cookieIndex, name="cookie_index"),
    path('cookie/login.html', cookieLogin, name="cookie_login"),
    path('session/index.html', sessionIndex, name="session_index"),
    path('session/login.html', sessionLogin, name="session_login"),
    path('session/logout.html', sessionLogout, name="session_logout"),
    # drf自带的token认证模式(post、username、password 换取token,
    # DEFAULT_AUTHENTICATION_CLASSES让页面的访问都需要请求头Authorization)
    path('token/api-auth/', views.obtain_auth_token),
    path('token/index.html', TokenIndexView.as_view(), name='token_index'),
    # drf自带的jwt认证模式(post、username、password 换取jwt,
    # DEFAULT_AUTHENTICATION_CLASSES让页面的访问都需要请求头Authorization)
    path('jwt/api-auth/', obtain_jwt_token),
    path('jwt/index.html', JWTIndexView.as_view(), name='jwt_index'),
]
